www.gusucode.com > VC++ 客户管理系统(SQL Serve)-源码程序 > VC++ 客户管理系统(SQL Serve)-源码程序/code/Program/xkh.cpp

    // xkh.cpp : implementation file
//

#include "stdafx.h"
#include "khmanager.h"
#include "xkh.h"
#include "ado.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// xkh dialog


xkh::xkh(CWnd* pParent /*=NULL*/)
	: CDialog(xkh::IDD, pParent)
{
	//{{AFX_DATA_INIT(xkh)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void xkh::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(xkh)
	DDX_Control(pDX, IDC_EDIT9, m_edit9);
	DDX_Control(pDX, IDC_EDIT8, m_edit8);
	DDX_Control(pDX, IDC_EDIT7, m_edit7);
	DDX_Control(pDX, IDC_EDIT6, m_edit6);
	DDX_Control(pDX, IDC_EDIT5, m_edit5);
	DDX_Control(pDX, IDC_EDIT4, m_edit4);
	DDX_Control(pDX, IDC_EDIT3, m_edit3);
	DDX_Control(pDX, IDC_EDIT2, m_edit2);
	DDX_Control(pDX, IDC_EDIT16, m_edit16);
	DDX_Control(pDX, IDC_EDIT15, m_edit15);
	DDX_Control(pDX, IDC_EDIT14, m_edit14);
	DDX_Control(pDX, IDC_EDIT13, m_edit13);
	DDX_Control(pDX, IDC_EDIT12, m_edit12);
	DDX_Control(pDX, IDC_EDIT11, m_edit11);
	DDX_Control(pDX, IDC_EDIT10, m_edit10);
	DDX_Control(pDX, IDC_EDIT1, m_edit1);
	DDX_Control(pDX, IDC_COMBO5, m_com5);
	DDX_Control(pDX, IDC_COMBO4, m_com4);
	DDX_Control(pDX, IDC_COMBO3, m_com3);
	DDX_Control(pDX, IDC_COMBO2, m_com2);
	DDX_Control(pDX, IDC_COMBO1, m_com1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(xkh, CDialog)
	//{{AFX_MSG_MAP(xkh)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// xkh message handlers

BOOL xkh::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	this->m_edit1.EnableWindow(false);
	m_edit1.SetWindowText(edit1);
	m_edit2.SetWindowText(edit2);
	m_edit3.SetWindowText(edit3);
	m_edit4.SetWindowText(edit4);
	m_edit5.SetWindowText(edit5);
	m_edit6.SetWindowText(edit6);
	m_edit7.SetWindowText(edit7);
	m_edit8.SetWindowText(edit8);
	m_edit9.SetWindowText(edit9);
	m_edit10.SetWindowText(edit10);
	m_edit11.SetWindowText(edit11);
	m_edit12.SetWindowText(edit12);
	m_edit13.SetWindowText(edit13);
	m_edit14.SetWindowText(edit14);
	m_edit15.SetWindowText(edit15);
	m_edit16.SetWindowText(edit16);
	m_com1.SetWindowText(com1);
	m_com2.SetWindowText(com2);
	m_com3.SetWindowText(com3);
	m_com4.SetWindowText(com4);
	m_com5.SetWindowText(com5);
	ado load;
	load.Open("select * from tb_Client_sfzy",adCmdText);
	int rstnum=load.GetRecordCount();
	int l;
	for(l=1;l<=rstnum;l++)
	{
		this->m_com3.AddString(load.GetFieldValue("sfzy_sfmc"));
		load.Move(l);
		
	}
load.Open("select * from tb_Client_qyxz",adCmdText);
rstnum=load.GetRecordCount();

	for(l=1;l<=rstnum;l++)
	{
		this->m_com1.AddString(load.GetFieldValue("qyxz_xzmc"));
		load.Move(l);
	}
	load.Open("select * from tb_Client_khjb",adCmdText);
rstnum=load.GetRecordCount();

	for(l=1;l<=rstnum;l++)
	{
		this->m_com4.AddString(load.GetFieldValue("khjb_jbmc"));
		load.Move(l);
	}
	load.Open("select * from tb_Client_qylx",adCmdText);
rstnum=load.GetRecordCount();

	for(l=1;l<=rstnum;l++)
	{
		this->m_com2.AddString(load.GetFieldValue("qylx_lxmc"));
		load.Move(l);
	}
	load.Open("select * from tb_Client_qyzx",adCmdText);
rstnum=load.GetRecordCount();

	for(l=1;l<=rstnum;l++)
	{
		this->m_com5.AddString(load.GetFieldValue("qyzx_zxjb"));
		load.Move(l);
	}
	load.close();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void xkh::OnButton2() 
{
this->OnCancel();	
}

void xkh::OnButton1() 
{
		
	m_edit1.GetWindowText(edit1);
	m_edit2.GetWindowText(edit2);
	m_edit3.GetWindowText(edit3);
	m_edit4.GetWindowText(edit4);
	m_edit5.GetWindowText(edit5);
	m_edit6.GetWindowText(edit6);
	m_edit7.GetWindowText(edit7);
	m_edit8.GetWindowText(edit8);
	m_edit9.GetWindowText(edit9);
	m_edit10.GetWindowText(edit10);
	m_edit11.GetWindowText(edit11);
	m_edit12.GetWindowText(edit12);
	m_edit13.GetWindowText(edit13);
	m_edit14.GetWindowText(edit14);
	m_edit15.GetWindowText(edit15);
	m_edit16.GetWindowText(edit16);
	m_com1.GetWindowText(com1);
	m_com2.GetWindowText(com2);
	m_com3.GetWindowText(com3);
	m_com4.GetWindowText(com4);
	m_com5.GetWindowText(com5);
	ado xkhrst;
	xkhrst.rstOpen("select * from tb_khxx");
	CString ss;
	ss.Format("UPDATE tb_khxx set khxx_mc='%s',khxx_qyxz='%s',khxx_qylx='%s',khxx_qyzx='%s',khxx_qydz='%s',khxx_szsf='%s',khxx_szcs='%s',khxx_gsyb='%s',khxx_frdb='%s',khxx_khyh='%s',khxx_yhzh='%s',khxx_nsh='%s',khxx_ICcard='%s',khxx_gswz='%s',khxx_gsdh='%s',khxx_gscz='%s',khxx_lxr='%s',khxx_lxrdh='%s',khxx_khjb='%s',khxx_bz='%s' where khxx_id='%s'",edit8,com1,com2,com5,edit2,com3,edit9,edit3,edit10,edit12,edit4,edit11,edit13,edit5,edit14,edit6,edit15,edit7,com4,edit16,edit1);
	xkhrst.ExecuteSQL(ss);
	MessageBox("修改成功","提示");
}

BOOL xkh::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
		pMsg->wParam=9;		
	return CDialog::PreTranslateMessage(pMsg);
}